//
//  AboutViewController.m
//  GiftNote
//
//  Created by wsh on 15/8/24.
//  Copyright (c) 2015年 GN. All rights reserved.
//

#import "AboutViewController.h"
#import "Screen.h"


@interface AboutViewController ()
@property (nonatomic, strong) UIImageView *tbView;
@property (nonatomic, strong) UILabel *edition;
@property (nonatomic, strong) UILabel *detail;
@property (nonatomic, strong) UILabel *contactUs;
@property (nonatomic, strong) UILabel *postLabel;
@end

@implementation AboutViewController

- (void)viewWillAppear:(BOOL)animated{

    self.tabBarController.tabBar.hidden = YES;
}


- (void)viewWillDisappear:(BOOL)animated{
    
    self.tabBarController.tabBar.hidden = NO;
}


- (void)viewDidLoad {
    [super viewDidLoad];
    self.navigationItem.title = @"关于礼记";
    self.view.backgroundColor = [UIColor whiteColor];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    
    [self addView];
}



- (void)addView{

    _tbView = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 120) / 2.0, 70, 120, 120)];
    _tbView.image = [UIImage imageNamed:@"tb"];
    [self.view addSubview:_tbView];
    
    _edition = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 180) / 2.0, CGRectGetMaxY(_tbView.frame), 180, 30)];
    _edition.textAlignment = NSTextAlignmentCenter;
    _edition.text = @"礼记v1.0";
    _edition.font = [UIFont systemFontOfSize:20];
    [self.view addSubview:_edition];
    
    _detail = [[UILabel alloc] initWithFrame:CGRectMake(10, CGRectGetMaxY(_edition.frame) + 20, SCREEN_WIDTH - 20, 100)];
    _detail.text = @"  以推荐礼物攻略为核心，收罗时下潮流的礼物和送礼物的方法，为用户呈现热门的礼物攻略，意在帮助用户给恋人、家人、朋友、同事制造生日、节日、纪念日惊喜.";
    _detail.numberOfLines = 0;
    _detail.font = [UIFont systemFontOfSize:18];
    _detail.frame = CGRectMake(10, CGRectGetMaxY(_edition.frame) + 30, SCREEN_WIDTH - 20, [AboutViewController heightOfString:_detail.text]);
    [self.view addSubview:_detail];
    
    
    _contactUs = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 180) / 2.0, SCREEN_HEIGHT - 200, 180, 30)];
    _contactUs.textAlignment = NSTextAlignmentCenter;
    _contactUs.text = @"联系我们";
    [self.view addSubview:_contactUs];
    
    _postLabel = [[UILabel alloc] initWithFrame:CGRectMake((SCREEN_WIDTH - 180) / 2.0, CGRectGetMaxY(_contactUs.frame) + 10, 180, 30)];
    _postLabel.textAlignment = NSTextAlignmentCenter;
    _postLabel.text = @"1042791902@qq.com";
    [self.view addSubview:_postLabel];
}











+ (CGFloat)heightOfString:(NSString *)str{
    
    NSDictionary *dic = [NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:18] forKey:NSFontAttributeName];
    CGRect bounds = [str boundingRectWithSize:CGSizeMake(SCREEN_WIDTH - 20, 0) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    return bounds.size.height;
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
}

@end
